package com.chuangfeng.framework.core.service;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import org.hibernate.Criteria;

import com.chuangfeng.framework.core.common.page.Pagination;

/**
 * 
 * 业务逻辑层接口
 * @author xiedy
 *
 * @param <T>
 */
public interface BaseMng<T extends Serializable> {
	
	public T load(Serializable id) ;
	
	public T get(Serializable id);

	public void add(T entity);

	public T saveAndRefresh(T entity);

	public T saveOrUpdate(T entity);

	public void delete(T entity) ;
	
	public void deleteById(Serializable id);
	
	public void deleteMulByIds(Serializable[] ids) ;

	public T update(T entity) ;

	public T merge(T entity) ;

	public List<T> findAll();
	
	public List<T> findByHql(String hql);
	
	public List<Map> findBySql(String sql);
	
	public Pagination searchPaginated(String hql);
	
	public Pagination searchPaginated(Criteria criteria);
	
	public String getIdName() ;
}
